﻿#This creates the definition for the resource
Import-Module xDSCResourceDesigner

$dscResourceName = "MESF_cInstallerFromMsDeployPackage"
$dscResourceFriendlyName = "cInstallerFromMsDeployPackage"

$scriptPath = $PSCommandPath
$scriptfile = Get-Item -Path $scriptPath

$schemaMofFile = $scriptfile.Directory.Parent.FullName

write-host "Start generating $schemaMofFile" -ForegroundColor Green

#The msdeploy package path
$Path = New-xDscResourceProperty -Name Path -Type String -Attribute Required

#The destination of package uncompress
$Destination = New-xDscResourceProperty -Name Destination -Type String -Attribute Key

#Identify if the action is to create the share or remove the share (i.e. should it be present or absent)
$Ensure    = New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -ValidateSet "Present", "Absent"

#Create the actual resource
New-xDscResource -Name $dscResourceName -Property $Path, $Destination, $Ensure -Path $schemaMofFile -FriendlyName $dscResourceFriendlyName

write-host "End generating $schemaMofFile" -ForegroundColor Green
